{% extends "base.html" %}

{% block content %}
<script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="/static/js/artDialog/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="/static/js/artDialog/plugins/iframeTools.js"></script>
<div id="return11">
	<table width="100%" align="center" cellpadding="1" class="aui-ibox-data aui-dotted-split">
	<tr>
		<th width="140">Username</th>
		<th width="100">Email</th>
		<th width="200">FromEmail</th>
		<th width='60'>States</th>
		<th width='200'>Fail Reason</th>
	</tr>
	{%if mails%}
		{%for m in mails%}
			<tr>
				<td>{{m.user_name}}</td>
				<td>{{m.mail_sendmail}}</td>
				<td><font color='gray'>{{m.mail_sendermail}}</font></td>
				<td>
					{%ifequal m.send_state 1%}<span style="color:red;font-size:14px;">×</span>{%endifequal%}
					{%ifequal m.send_state 0%}<span style="color:gray;font-size:14px;">×</span>{%endifequal%}
					{%ifequal m.send_state 4%}<span style="color:gray;font-size:14px;">退</span>{%endifequal%}
					{%ifequal m.send_state 2%}<span style="color:green;font-size:14px;">√</span>{%endifequal%}
					{%ifequal m.send_state 3%}<span style="color:green;font-size:14px;">√</span>{%endifequal%}
				</td>
				<td>
					<font color='gray'>{{m.fail_reason}}</font>
				</td>
			<tr>
		{%endfor%}
	{%else%}
		<tr>
			<td colspan="3" align='center'><span style="color:green;font-size:14px;line-height:25px">No Emails!</span></td>
		<tr>
	{%endif%}
		<tr id="pages" style="display:none;">
			<td align="center" colspan="10">
				<div id="pages11" class="pager"></div>
			</td>
		</tr>
	</table>

<script>
(function initdata(){
	var tolpage = {{tolpage}}
	var page = {{page}}
	var id = {{mid}}
	if(tolpage<=1)return false;
	$('#pages').show()
	var i = 1;
	if(tolpage>10){
		i=(page-5)>1?page-5:1
		tolpage = tolpage>(page + 5)?page+5:tolpage
	}
	for(i;i<=tolpage;i++){
		var c = ''
		if(i=={{page}}){
			c = 'active'
		}
		
		$('#pages11').append("<li><a href='/optsmaillist?page="+i+"&id="+id+"&opt=watchsendinfo' onclick=\"$.get(this.href,function(e){$(\'#return11\').html(e)});return false;\" class='"+c+"'>"+i+"</a></li>")
	}
})()
</script>
</div>
{% endblock %}